<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 5.4.0">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/favicon.ico">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon.ico">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon.ico">
  <link rel="mask-icon" href="/images/favicon.ico" color="#222">

<link rel="stylesheet" href="/css/main.css">


<link rel="stylesheet" href="/lib/font-awesome/css/all.min.css">

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"yoursite.com","root":"/","scheme":"Mist","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"always","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":false,"show_result":false,"style":null},"back2top":{"enable":true,"sidebar":false,"scrollpercent":false},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":false,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},"path":"search.xml"};
  </script>

  <meta name="description" content="Hexo一些概念、命令、配置">
<meta property="og:type" content="article">
<meta property="og:title" content="Hexo介绍">
<meta property="og:url" content="http://yoursite.com/2018/10/18/blog-2018-10-18-HexoIntro/index.html">
<meta property="og:site_name" content="Akiyama&#39;s Blog">
<meta property="og:description" content="Hexo一些概念、命令、配置">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2018-10-17T16:00:00.000Z">
<meta property="article:modified_time" content="2018-10-24T17:09:30.013Z">
<meta property="article:author" content="丘山月夜">
<meta property="article:tag" content="工具">
<meta property="article:tag" content="Hexo">
<meta property="article:tag" content="博客">
<meta name="twitter:card" content="summary">

<link rel="canonical" href="http://yoursite.com/2018/10/18/blog-2018-10-18-HexoIntro/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-CN'
  };
</script>

  <title>Hexo介绍 | Akiyama's Blog</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">Akiyama's Blog</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
      <p class="site-subtitle" itemprop="description">丘山月夜的博客</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="main-menu menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="home fa fa-home fa-fw"></i>首页</a>

  </li>
        <li class="menu-item menu-item-about">

    <a href="/about/" rel="section"><i class="user fa fa-user fa-fw"></i>关于</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/tags/" rel="section"><i class="tags fa fa-tags fa-fw"></i>标签</a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/categories/" rel="section"><i class="th fa fa-th fa-fw"></i>分类</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="archive fa fa-archive fa-fw"></i>归档</a>

  </li>
  </ul>
</nav>




</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content post posts-expand">
            

    
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="http://yoursite.com/2018/10/18/blog-2018-10-18-HexoIntro/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.png">
      <meta itemprop="name" content="丘山月夜">
      <meta itemprop="description" content="君は空を見てるか,<br>風の音を聞いてるか">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Akiyama's Blog">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          Hexo介绍
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2018-10-18 00:00:00" itemprop="dateCreated datePublished" datetime="2018-10-18T00:00:00+08:00">2018-10-18</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2018-10-25 01:09:30" itemprop="dateModified" datetime="2018-10-25T01:09:30+08:00">2018-10-25</time>
              </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/" itemprop="url" rel="index"><span itemprop="name"></span></a>
                </span>
            </span>

          
            <div class="post-description">Hexo一些概念、命令、配置</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <h2 id="1-Hexo目录"><a href="#1-Hexo目录" class="headerlink" title="1 Hexo目录"></a>1 Hexo目录</h2><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">.</span><br><span class="line">├── _config.yml 	&#x2F;&#x2F;站点配置文件</span><br><span class="line">├── package.json	&#x2F;&#x2F;npm配置</span><br><span class="line">├── scaffolds		&#x2F;&#x2F;模版 文件夹。当您新建文章时，Hexo 会根据 scaffold 来建立文件。</span><br><span class="line">├── source			&#x2F;&#x2F;子文件夹相当于一个个页面(page)，每个页面对应一个布局文件，可以修改主题里的配置文件改变样式</span><br><span class="line">|   ├── _drafts		&#x2F;&#x2F;草稿页面：存放所有草稿</span><br><span class="line">|   ├── _posts		&#x2F;&#x2F;文章页面：存放所有文章，所有文章都是同一个布局</span><br><span class="line">|   ├── about		&#x2F;&#x2F;关于页面</span><br><span class="line">|   ├── categories	&#x2F;&#x2F;分类页面</span><br><span class="line">|   ├── tags		&#x2F;&#x2F;标签页面</span><br><span class="line">|   └──………………</span><br><span class="line">└── themes			&#x2F;&#x2F;主题</span><br></pre></td></tr></table></figure>



<h2 id="2-Hexo一些基本概念"><a href="#2-Hexo一些基本概念" class="headerlink" title="2. Hexo一些基本概念"></a>2. Hexo一些基本概念</h2><h3 id="2-1-Front-matter"><a href="#2-1-Front-matter" class="headerlink" title="2.1 Front-matter"></a>2.1 Front-matter</h3><p>前页（扉页、版权页、目次等），位于文章最上方<code>---</code>分隔的区域，做一些变量声明和配置。也可以用json格式，使用<code>;;;</code>分隔</p>
<table>
<thead>
<tr>
<th>参数</th>
<th>描述</th>
<th>默认值</th>
</tr>
</thead>
<tbody><tr>
<td><code>layout</code></td>
<td>布局</td>
<td></td>
</tr>
<tr>
<td><code>title</code></td>
<td>标题</td>
<td></td>
</tr>
<tr>
<td><code>date</code></td>
<td>建立日期</td>
<td>文件建立日期</td>
</tr>
<tr>
<td><code>updated</code></td>
<td>更新日期</td>
<td>文件更新日期</td>
</tr>
<tr>
<td><code>comments</code></td>
<td>开启文章的评论功能</td>
<td>true</td>
</tr>
<tr>
<td><code>tags</code></td>
<td>标签（不适用于分页），无顺序</td>
<td></td>
</tr>
<tr>
<td><code>categories</code></td>
<td>分类（不适用于分页），有顺序</td>
<td></td>
</tr>
<tr>
<td><code>permalink</code></td>
<td>覆盖文章网址</td>
<td></td>
</tr>
</tbody></table>
<h3 id="2-2-模板（Scaffold）"><a href="#2-2-模板（Scaffold）" class="headerlink" title="2.2 模板（Scaffold）"></a>2.2 模板（Scaffold）</h3><p>模板决定了网站内容的呈现方式，可以根据模板生成初始化文章</p>
<table>
<thead>
<tr>
<th>模板</th>
<th>用途</th>
<th>回调</th>
</tr>
</thead>
<tbody><tr>
<td>index</td>
<td>首页</td>
<td>post</td>
</tr>
<tr>
<td>post</td>
<td>文章</td>
<td>index</td>
</tr>
<tr>
<td>page</td>
<td>分页</td>
<td>index</td>
</tr>
<tr>
<td>archive</td>
<td>归档</td>
<td>index</td>
</tr>
<tr>
<td>category</td>
<td>分类归档</td>
<td>archive</td>
</tr>
<tr>
<td>tag</td>
<td>标签归档</td>
<td>archive</td>
</tr>
</tbody></table>
<h3 id="2-3-局部模版（Partial）"><a href="#2-3-局部模版（Partial）" class="headerlink" title="2.3 局部模版（Partial）"></a>2.3 局部模版（Partial）</h3><p>可以在不同模板之间共享相同的组件，例如页首（Header）、页脚（Footer）或侧边栏（Sidebar）等，可利用局部模板功能分割为个别文件，让维护更加便利</p>
<h3 id="2-4-布局（Layout）"><a href="#2-4-布局（Layout）" class="headerlink" title="2.4 布局（Layout）"></a>2.4 布局（Layout）</h3><p>如果页面结构类似，例如两个模板都有页首（Header）和页脚（Footer），您可考虑通过「布局」让两个模板共享相同的结构。一个布局文件必须要能显示 body 变量的内容，如此一来模板的内容才会被显示</p>
<h3 id="2-5-变量"><a href="#2-5-变量" class="headerlink" title="2.5 变量"></a>2.5 变量</h3><h4 id="全局变量"><a href="#全局变量" class="headerlink" title="全局变量"></a>全局变量</h4><table>
<thead>
<tr>
<th>变量</th>
<th>描述</th>
</tr>
</thead>
<tbody><tr>
<td><code>site</code></td>
<td><a target="_blank" rel="noopener" href="https://hexo.io/zh-cn/docs/variables#%E7%BD%91%E7%AB%99%E5%8F%98%E9%87%8F">网站变量</a></td>
</tr>
<tr>
<td><code>page</code></td>
<td>针对该页面的内容以及 front-matter 所设定的变量。</td>
</tr>
<tr>
<td><code>config</code></td>
<td>网站配置</td>
</tr>
<tr>
<td><code>theme</code></td>
<td>主题配置。继承自网站配置。</td>
</tr>
<tr>
<td><code>_</code> (单下划线)</td>
<td><a target="_blank" rel="noopener" href="http://lodash.com/">Lodash</a> 函数库</td>
</tr>
<tr>
<td><code>path</code></td>
<td>当前页面的路径（不含根路径）</td>
</tr>
<tr>
<td><code>url</code></td>
<td>当前页面的完整网址</td>
</tr>
<tr>
<td><code>env</code></td>
<td>环境变量</td>
</tr>
</tbody></table>
<h4 id="网站变量"><a href="#网站变量" class="headerlink" title="网站变量"></a>网站变量</h4><table>
<thead>
<tr>
<th>变量</th>
<th>描述</th>
</tr>
</thead>
<tbody><tr>
<td><code>site.posts</code></td>
<td>所有文章</td>
</tr>
<tr>
<td><code>site.pages</code></td>
<td>所有分页</td>
</tr>
<tr>
<td><code>site.categories</code></td>
<td>所有分类</td>
</tr>
<tr>
<td><code>site.tags</code></td>
<td>所有标签</td>
</tr>
</tbody></table>
<h4 id="页面变量"><a href="#页面变量" class="headerlink" title="页面变量"></a>页面变量</h4><h5 id="页面（page）"><a href="#页面（page）" class="headerlink" title="页面（page）"></a>页面（page）</h5><table>
<thead>
<tr>
<th>变量</th>
<th>描述</th>
</tr>
</thead>
<tbody><tr>
<td><code>page.title</code></td>
<td>页面标题</td>
</tr>
<tr>
<td><code>page.date</code></td>
<td>页面建立日期（<a target="_blank" rel="noopener" href="http://momentjs.com/">Moment.js</a> 对象）</td>
</tr>
<tr>
<td><code>page.updated</code></td>
<td>页面更新日期（<a target="_blank" rel="noopener" href="http://momentjs.com/">Moment.js</a> 对象）</td>
</tr>
<tr>
<td><code>page.comments</code></td>
<td>留言是否开启</td>
</tr>
<tr>
<td><code>page.layout</code></td>
<td>布局名称</td>
</tr>
<tr>
<td><code>page.content</code></td>
<td>页面的完整内容</td>
</tr>
<tr>
<td><code>page.excerpt</code></td>
<td>页面摘要</td>
</tr>
<tr>
<td><code>page.more</code></td>
<td>除了页面摘要的其余内容</td>
</tr>
<tr>
<td><code>page.source</code></td>
<td>页面原始路径</td>
</tr>
<tr>
<td><code>page.full_source</code></td>
<td>页面的完整原始路径</td>
</tr>
<tr>
<td><code>page.path</code></td>
<td>页面网址（不含根路径）。我们通常在主题中使用 <code>url_for(page.path)</code>。</td>
</tr>
<tr>
<td><code>page.permalink</code></td>
<td>页面的完整网址</td>
</tr>
<tr>
<td><code>page.prev</code></td>
<td>上一个页面。如果此为第一个页面则为 <code>null</code>。</td>
</tr>
<tr>
<td><code>page.next</code></td>
<td>下一个页面。如果此为最后一个页面则为 <code>null</code>。</td>
</tr>
<tr>
<td><code>page.raw</code></td>
<td>文章的原始内容</td>
</tr>
<tr>
<td><code>page.photos</code></td>
<td>文章的照片（用于相簿）</td>
</tr>
<tr>
<td><code>page.link</code></td>
<td>文章的外部链接（用于链接文章）</td>
</tr>
</tbody></table>
<h5 id="文章（post）：和-page-布局类似，但是添加了下列变量。"><a href="#文章（post）：和-page-布局类似，但是添加了下列变量。" class="headerlink" title="文章（post）：和 page 布局类似，但是添加了下列变量。"></a>文章（post）：和 <code>page</code> 布局类似，但是添加了下列变量。</h5><table>
<thead>
<tr>
<th>Variable</th>
<th>Description</th>
</tr>
</thead>
<tbody><tr>
<td><code>page.published</code></td>
<td>如果该文章已发布则为True</td>
</tr>
<tr>
<td><code>page.categories</code></td>
<td>该文章的所有分类</td>
</tr>
<tr>
<td><code>page.tags</code></td>
<td>该文章的所有标签</td>
</tr>
</tbody></table>
<h5 id="首页（index）"><a href="#首页（index）" class="headerlink" title="首页（index）"></a>首页（index）</h5><table>
<thead>
<tr>
<th>变量</th>
<th>描述</th>
</tr>
</thead>
<tbody><tr>
<td><code>page.per_page</code></td>
<td>每页显示的文章数量</td>
</tr>
<tr>
<td><code>page.total</code></td>
<td>总文章数</td>
</tr>
<tr>
<td><code>page.current</code></td>
<td>目前页数</td>
</tr>
<tr>
<td><code>page.current_url</code></td>
<td>目前分页的网址</td>
</tr>
<tr>
<td><code>page.posts</code></td>
<td>本页文章</td>
</tr>
<tr>
<td><code>page.prev</code></td>
<td>上一页的页数。如果此页是第一页的话则为 <code>0</code>。</td>
</tr>
<tr>
<td><code>page.prev_link</code></td>
<td>上一页的网址。如果此页是第一页的话则为 <code>&#39;&#39;</code>。</td>
</tr>
<tr>
<td><code>page.next</code></td>
<td>下一页的页数。如果此页是最后一页的话则为 <code>0</code>。</td>
</tr>
<tr>
<td><code>page.next_link</code></td>
<td>下一页的网址。如果此页是最后一页的话则为 <code>&#39;&#39;</code>。</td>
</tr>
<tr>
<td><code>page.path</code></td>
<td>当前页面的路径（不含根目录）。我们通常在主题中使用 <code>url_for(page.path)</code>。</td>
</tr>
</tbody></table>
<h5 id="归档-archive-：与-index-布局相同，但新增以下变量。"><a href="#归档-archive-：与-index-布局相同，但新增以下变量。" class="headerlink" title="归档 (archive)：与 index 布局相同，但新增以下变量。"></a>归档 (archive)：与 <code>index</code> 布局相同，但新增以下变量。</h5><table>
<thead>
<tr>
<th>变量</th>
<th>描述</th>
</tr>
</thead>
<tbody><tr>
<td><code>page.archive</code></td>
<td>等于 <code>true</code></td>
</tr>
<tr>
<td><code>page.year</code></td>
<td>年份归档 (4位)</td>
</tr>
<tr>
<td><code>page.month</code></td>
<td>月份归档 (没有前导零的2位数)</td>
</tr>
</tbody></table>
<h5 id="分类-category-：与-index-布局相同，但新增以下变量。"><a href="#分类-category-：与-index-布局相同，但新增以下变量。" class="headerlink" title="分类 (category)：与 index 布局相同，但新增以下变量。"></a>分类 (category)：与 <code>index</code> 布局相同，但新增以下变量。</h5><table>
<thead>
<tr>
<th>变量</th>
<th>描述</th>
</tr>
</thead>
<tbody><tr>
<td><code>page.category</code></td>
<td>分类名称</td>
</tr>
</tbody></table>
<h5 id="标签-tag-：与-index-布局相同，但新增以下变量。"><a href="#标签-tag-：与-index-布局相同，但新增以下变量。" class="headerlink" title="标签 (tag)：与 index 布局相同，但新增以下变量。"></a>标签 (tag)：与 <code>index</code> 布局相同，但新增以下变量。</h5><table>
<thead>
<tr>
<th>变量</th>
<th>描述</th>
</tr>
</thead>
<tbody><tr>
<td><code>page.tag</code></td>
<td>标签名称</td>
</tr>
</tbody></table>
<h2 id="3-Hexo常用命令"><a href="#3-Hexo常用命令" class="headerlink" title="3. Hexo常用命令"></a>3. Hexo常用命令</h2><h3 id="3-1-安装插件"><a href="#3-1-安装插件" class="headerlink" title="3.1 安装插件"></a>3.1 安装插件</h3><table>
<thead>
<tr>
<th>命令</th>
<th>解释</th>
</tr>
</thead>
<tbody><tr>
<td>npm install -g hexo-cli</td>
<td>安装hexo插件</td>
</tr>
<tr>
<td>npm update -g hexo-cli</td>
<td>升级</td>
</tr>
<tr>
<td>npm install hexo-deployer-git –save</td>
<td>安装部署git插件</td>
</tr>
<tr>
<td>hexo –version、hexo -v</td>
<td>查看版本</td>
</tr>
<tr>
<td>hexo list <type></td>
<td>列出网站资料</td>
</tr>
</tbody></table>
<h3 id="3-2-简写"><a href="#3-2-简写" class="headerlink" title="3.2 简写"></a>3.2 简写</h3><table>
<thead>
<tr>
<th>简写</th>
<th>完整</th>
<th>解释</th>
</tr>
</thead>
<tbody><tr>
<td>hexo n “我的博客”</td>
<td>hexo new “我的博客”</td>
<td>新建文章</td>
</tr>
<tr>
<td>hexo p</td>
<td>hexo publish</td>
<td>发表草稿</td>
</tr>
<tr>
<td>hexo g</td>
<td>hexo generate</td>
<td>生成，</td>
</tr>
<tr>
<td>hexo s</td>
<td>hexo server</td>
<td>启动服务预览</td>
</tr>
<tr>
<td>hexo d</td>
<td>hexo deploy</td>
<td>将.deploy目录部署到GitHub</td>
</tr>
</tbody></table>
<h3 id="3-3-基本流程"><a href="#3-3-基本流程" class="headerlink" title="3.3 基本流程"></a>3.3 基本流程</h3><table>
<thead>
<tr>
<th>命令</th>
<th>解释</th>
</tr>
</thead>
<tbody><tr>
<td>hexo init [folder]</td>
<td>新建站点。如果没有设置 <code>folder</code> ，Hexo 默认在目前的文件夹建立站点。</td>
</tr>
<tr>
<td>hexo server</td>
<td>启动服务，监视文件变动并自动更新，无须重启服务器。默认地址：<a target="_blank" rel="noopener" href="http://localhost:4000/">http://localhost:4000/</a></td>
</tr>
<tr>
<td>hexo server -s</td>
<td>静态模式，只使用静态文件</td>
</tr>
<tr>
<td>hexo server -p 5000</td>
<td>指定服务端口启动，默认4000</td>
</tr>
<tr>
<td>hexo server -i 192.168.1.1</td>
<td>自定义 IP，默认localhost</td>
</tr>
<tr>
<td>hexo server -l</td>
<td>启动日记记录，使用覆盖记录格式</td>
</tr>
<tr>
<td>hexo clean</td>
<td>清除缓存文件 (<code>db.json</code>) 和已生成的静态文件 (<code>public</code>)。</td>
</tr>
<tr>
<td>hexo g</td>
<td>生成静态网页至public目录</td>
</tr>
<tr>
<td>hexo g –watch</td>
<td>监视文件变动</td>
</tr>
<tr>
<td>hexo d</td>
<td>部署网站</td>
</tr>
</tbody></table>
<h3 id="3-4-写作"><a href="#3-4-写作" class="headerlink" title="3.4 写作"></a>3.4 写作</h3><table>
<thead>
<tr>
<th>命令</th>
<th>解释</th>
</tr>
</thead>
<tbody><tr>
<td>hexo publish [layout] <title></td>
<td>发表草稿</td>
</tr>
<tr>
<td>hexo new [layout] <title></td>
<td>新建文章。如果没有设置 <code>layout</code> 的话，默认使用站点配置文件 <a target="_blank" rel="noopener" href="https://hexo.io/zh-cn/docs/configuration">_config.yml</a> 中的 <code>default_layout</code> 参数（默认为post）代替。如果标题包含空格的话，使用引号括起来。<br>hexo new post 文章名：新建文章<br>hexo new page 页面名：新建页面，如关于、分类、标签<br>hexo new draft 草稿名：新建草稿</td>
</tr>
</tbody></table>
<h3 id="3-5-其他选项"><a href="#3-5-其他选项" class="headerlink" title="3.5 其他选项"></a>3.5 其他选项</h3><table>
<thead>
<tr>
<th>命令</th>
<th>解释</th>
</tr>
</thead>
<tbody><tr>
<td>hexo –safe</td>
<td>在安全模式下，不会载入插件和脚本。安装新插件遭遇问题时，可以尝试以安全模式重新执行</td>
</tr>
<tr>
<td>hexo –debug</td>
<td>在终端中显示调试信息并记录到 <code>debug.log</code></td>
</tr>
<tr>
<td>hexo –silent</td>
<td>隐藏终端信息</td>
</tr>
<tr>
<td>hexo –config custom.yml</td>
<td>自定义配置文件的路径，执行后将不再使用 <code>_config.yml</code></td>
</tr>
<tr>
<td>hexo –draft</td>
<td>显示 <code>source/_drafts</code> 文件夹中的草稿文章</td>
</tr>
<tr>
<td>hexo –cwd /path/to/cwd</td>
<td>自定义当前工作目录（Current working directory）的路径。</td>
</tr>
</tbody></table>
<h2 id="4-Hexo配置参数说明"><a href="#4-Hexo配置参数说明" class="headerlink" title="4. Hexo配置参数说明"></a>4. Hexo配置参数说明</h2><p>站点配置文件：<code>站点根目录/_config.yml</code></p>
<table>
<thead>
<tr>
<th>字段</th>
<th>说明</th>
</tr>
</thead>
<tbody><tr>
<td>title</td>
<td>网站标题</td>
</tr>
<tr>
<td>subtitle</td>
<td>副标题</td>
</tr>
<tr>
<td>description</td>
<td>描述、签名</td>
</tr>
<tr>
<td>keywords</td>
<td>博客关键字，利于SEO（搜索引擎优化）</td>
</tr>
<tr>
<td>author</td>
<td>作者、昵称</td>
</tr>
<tr>
<td>language</td>
<td>语言，如zh-Hans</td>
</tr>
<tr>
<td>timezone</td>
<td>时区</td>
</tr>
<tr>
<td>theme</td>
<td>主题</td>
</tr>
<tr>
<td>deploy</td>
<td>部署网站</td>
</tr>
<tr>
<td>permalink</td>
<td>永久链接</td>
</tr>
</tbody></table>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">deploy: </span><br><span class="line">    type: 部署方式，如git</span><br><span class="line">    repo: 仓库地址</span><br><span class="line">    branch: 分支名</span><br></pre></td></tr></table></figure>

<p>permalink配置示例：<br>使用<code>hexo new post &quot;文章&quot;</code>生成文章时会自动命名，并且生成静态文件时会生成相应的文件夹路径。<br>| 参数                            | 结果                        |<br>| ——————————- | ————————— |<br>| <code>:year/:month/:day/:title/</code>     | 2013/07/14/hello-world      |<br>| <code>:year-:month-:day-:title.html</code> | 2013-07-14-hello-world.html |<br>| <code>:category/:title</code>              | foo/bar/hello-world         |</p>
<p>permalink变量<br>| 变量          | 描述                                                       |<br>| ————- | ———————————————————- |<br>| <code>:year</code>       | 文章的发表年份（4 位数）                                   |<br>| <code>:month</code>      | 文章的发表月份（2 位数）                                   |<br>| <code>:i_month</code>    | 文章的发表月份（去掉开头的零）                             |<br>| <code>:day</code>        | 文章的发表日期 (2 位数)                                    |<br>| <code>:i_day</code>      | 文章的发表日期（去掉开头的零）                             |<br>| <code>:title</code>      | 文件名称                                                   |<br>| <code>:post_title</code> | 文章标题                                                   |<br>| <code>:id</code>         | 文章 ID                                                    |<br>| <code>:category</code>   | 分类。如果文章没有分类，则是 <code>default_category</code> 配置信息。 |</p>
<h2 id="结束语"><a href="#结束语" class="headerlink" title="结束语"></a>结束语</h2><p>参考<a target="_blank" rel="noopener" href="https://hexo.io/zh-cn/docs/">Hexo官方文档</a>，下篇介绍Hexo更换主题：以NexT为例，并进行简单的配置。</p>

    </div>

    
    
    
        

  <div class="followme">
    <p>欢迎关注我的其它发布渠道</p>

    <div class="social-list">

        <div class="social-item">
          <a target="_blank" class="social-link" href="/images/wechat_channel.jpg">
            <span class="icon">
              <i class="fab fa-weixin"></i>
            </span>

            <span class="label">WeChat</span>
          </a>
        </div>
    </div>
  </div>


      <footer class="post-footer">
          
          <div class="post-tags">
              <a href="/" rel="tag"><i class="fa fa-tag"></i> </a>
              <a href="/" rel="tag"><i class="fa fa-tag"></i> </a>
              <a href="/" rel="tag"><i class="fa fa-tag"></i> </a>
          </div>

        


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/2018/10/17/blog-2018-10-17-Hexo-GitPage/" rel="prev" title="Hexo+GitPage搭建博客">
      <i class="fa fa-chevron-left"></i> Hexo+GitPage搭建博客
    </a></div>
      <div class="post-nav-item">
    <a href="/2018/10/19/blog-2018-10-19-HexoTheme-NexT/" rel="next" title="Hexo更换主题：NexT">
      Hexo更换主题：NexT <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  



          </div>
          

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="header-overlay"></div>
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#1-Hexo%E7%9B%AE%E5%BD%95"><span class="nav-number">1.</span> <span class="nav-text">1 Hexo目录</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-Hexo%E4%B8%80%E4%BA%9B%E5%9F%BA%E6%9C%AC%E6%A6%82%E5%BF%B5"><span class="nav-number">2.</span> <span class="nav-text">2. Hexo一些基本概念</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#2-1-Front-matter"><span class="nav-number">2.1.</span> <span class="nav-text">2.1 Front-matter</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-2-%E6%A8%A1%E6%9D%BF%EF%BC%88Scaffold%EF%BC%89"><span class="nav-number">2.2.</span> <span class="nav-text">2.2 模板（Scaffold）</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-3-%E5%B1%80%E9%83%A8%E6%A8%A1%E7%89%88%EF%BC%88Partial%EF%BC%89"><span class="nav-number">2.3.</span> <span class="nav-text">2.3 局部模版（Partial）</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-4-%E5%B8%83%E5%B1%80%EF%BC%88Layout%EF%BC%89"><span class="nav-number">2.4.</span> <span class="nav-text">2.4 布局（Layout）</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-5-%E5%8F%98%E9%87%8F"><span class="nav-number">2.5.</span> <span class="nav-text">2.5 变量</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#%E5%85%A8%E5%B1%80%E5%8F%98%E9%87%8F"><span class="nav-number">2.5.1.</span> <span class="nav-text">全局变量</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#%E7%BD%91%E7%AB%99%E5%8F%98%E9%87%8F"><span class="nav-number">2.5.2.</span> <span class="nav-text">网站变量</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#%E9%A1%B5%E9%9D%A2%E5%8F%98%E9%87%8F"><span class="nav-number">2.5.3.</span> <span class="nav-text">页面变量</span></a><ol class="nav-child"><li class="nav-item nav-level-5"><a class="nav-link" href="#%E9%A1%B5%E9%9D%A2%EF%BC%88page%EF%BC%89"><span class="nav-number">2.5.3.1.</span> <span class="nav-text">页面（page）</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#%E6%96%87%E7%AB%A0%EF%BC%88post%EF%BC%89%EF%BC%9A%E5%92%8C-page-%E5%B8%83%E5%B1%80%E7%B1%BB%E4%BC%BC%EF%BC%8C%E4%BD%86%E6%98%AF%E6%B7%BB%E5%8A%A0%E4%BA%86%E4%B8%8B%E5%88%97%E5%8F%98%E9%87%8F%E3%80%82"><span class="nav-number">2.5.3.2.</span> <span class="nav-text">文章（post）：和 page 布局类似，但是添加了下列变量。</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#%E9%A6%96%E9%A1%B5%EF%BC%88index%EF%BC%89"><span class="nav-number">2.5.3.3.</span> <span class="nav-text">首页（index）</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#%E5%BD%92%E6%A1%A3-archive-%EF%BC%9A%E4%B8%8E-index-%E5%B8%83%E5%B1%80%E7%9B%B8%E5%90%8C%EF%BC%8C%E4%BD%86%E6%96%B0%E5%A2%9E%E4%BB%A5%E4%B8%8B%E5%8F%98%E9%87%8F%E3%80%82"><span class="nav-number">2.5.3.4.</span> <span class="nav-text">归档 (archive)：与 index 布局相同，但新增以下变量。</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#%E5%88%86%E7%B1%BB-category-%EF%BC%9A%E4%B8%8E-index-%E5%B8%83%E5%B1%80%E7%9B%B8%E5%90%8C%EF%BC%8C%E4%BD%86%E6%96%B0%E5%A2%9E%E4%BB%A5%E4%B8%8B%E5%8F%98%E9%87%8F%E3%80%82"><span class="nav-number">2.5.3.5.</span> <span class="nav-text">分类 (category)：与 index 布局相同，但新增以下变量。</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#%E6%A0%87%E7%AD%BE-tag-%EF%BC%9A%E4%B8%8E-index-%E5%B8%83%E5%B1%80%E7%9B%B8%E5%90%8C%EF%BC%8C%E4%BD%86%E6%96%B0%E5%A2%9E%E4%BB%A5%E4%B8%8B%E5%8F%98%E9%87%8F%E3%80%82"><span class="nav-number">2.5.3.6.</span> <span class="nav-text">标签 (tag)：与 index 布局相同，但新增以下变量。</span></a></li></ol></li></ol></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-Hexo%E5%B8%B8%E7%94%A8%E5%91%BD%E4%BB%A4"><span class="nav-number">3.</span> <span class="nav-text">3. Hexo常用命令</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#3-1-%E5%AE%89%E8%A3%85%E6%8F%92%E4%BB%B6"><span class="nav-number">3.1.</span> <span class="nav-text">3.1 安装插件</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-2-%E7%AE%80%E5%86%99"><span class="nav-number">3.2.</span> <span class="nav-text">3.2 简写</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-3-%E5%9F%BA%E6%9C%AC%E6%B5%81%E7%A8%8B"><span class="nav-number">3.3.</span> <span class="nav-text">3.3 基本流程</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-4-%E5%86%99%E4%BD%9C"><span class="nav-number">3.4.</span> <span class="nav-text">3.4 写作</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-5-%E5%85%B6%E4%BB%96%E9%80%89%E9%A1%B9"><span class="nav-number">3.5.</span> <span class="nav-text">3.5 其他选项</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#4-Hexo%E9%85%8D%E7%BD%AE%E5%8F%82%E6%95%B0%E8%AF%B4%E6%98%8E"><span class="nav-number">4.</span> <span class="nav-text">4. Hexo配置参数说明</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E7%BB%93%E6%9D%9F%E8%AF%AD"><span class="nav-number">5.</span> <span class="nav-text">结束语</span></a></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="丘山月夜"
      src="/images/avatar.png">
  <p class="site-author-name" itemprop="name">丘山月夜</p>
  <div class="site-description" itemprop="description">君は空を見てるか,<br>風の音を聞いてるか</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">60</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/categories/">
          
        <span class="site-state-item-count">14</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
          
        <span class="site-state-item-count">21</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>



      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2021</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">丘山月夜</span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://mist.theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Mist</a> 强力驱动
  </div>

        








      </div>
    </footer>
  </div>

  
  <script src="/lib/anime.min.js"></script>
  <script src="/lib/velocity/velocity.min.js"></script>
  <script src="/lib/velocity/velocity.ui.min.js"></script>

<script src="/js/utils.js"></script>

<script src="/js/motion.js"></script>


<script src="/js/schemes/muse.js"></script>


<script src="/js/next-boot.js"></script>




  















  

  

</body>
</html>
